import Vue from 'vue'
import VueRouter from 'vue-router'
import IndexLayout from '../layout/IndexLayout.vue'

import Me from '../views/Me.vue'
import Register from '../views/Register.vue'
import Forget from '../views/ForgetPwd.vue'
import ChangeInformation from '../views/ChangeInformation.vue'
import Index from '../views/Index.vue'
import PostsList from '../components/PostsList.vue'
import Theme from '../components/Theme.vue'
import ThemePostsList from '../views/ThemePostsList.vue'
import PostDetail from '../views/PostDetail.vue'
import Search from '../views/Search.vue'
import Login from '../views/Login.vue'
import MyPosts from '../views/MyPosts.vue'
import PublishPosts from '../views/PublishPosts.vue'
import Comment from '../views/Comment.vue'
import CommentReply from '../views/CommentReply.vue'

Vue.use(VueRouter)
const routes = [
  {
    path:'/',
    redirect:'/home'
  },
  {
    path: '/home',
    name: 'Home',
    component: IndexLayout,
    children:[
      {
        path: '/',
        redirect: 'index'
      },
      {
        path:'me',
        component:Me
      },
      {
        path:'register',
        component:Register
      },
      {
        path:'forget',
        component:Forget
      },
      {
        path:'changeInformation',
        component:ChangeInformation
      },
      {
        path: 'index',
        name: 'Index',
        component: Index,
        children: [
          {
            path:"/",
            redirect:"posts-list"
          },
          {
            path: 'posts-list',
            component: PostsList
          },
          {
            path: 'theme',
            component: Theme
          },
        ]
      },
      {
        path:'theme-posts-list',
        component:ThemePostsList
      },
      {
        path:'post-detail',
        component:PostDetail,
        children:[

        ]
      },
      {
        path:'search',
        component:Search
      },
      {
        path:'login',
        component:Login
      },
      {
        path:'my-posts',
        component:MyPosts
      },
      {
        path:'publish-posts',
        component:PublishPosts
      },
      {
        path:'comment',
        component:Comment,
      },
      {
        path:'Comment-reply',
        component:CommentReply,
      }
    ]
  },

]


const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
